﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace FrameWorkSong
{
    public class TwoPanel : BasePanel
    {
        //private CanvasGroup canvasGroup;
        void Start()
        {
            if (canvasGroup == null)
            {
                gameObject.AddComponent<CanvasGroup>();
                canvasGroup = GetComponent<CanvasGroup>();
            }
        }
        public override void OnEnter()
        {
            if (canvasGroup == null)
            {
                gameObject.AddComponent<CanvasGroup>();
                canvasGroup = GetComponent<CanvasGroup>();
            }
            canvasGroup.alpha = 1;
            canvasGroup.blocksRaycasts = true;
        }
        public override void OnExit()
        {
            canvasGroup.alpha = 0;
            canvasGroup.blocksRaycasts = false;
        }
        public override void OnPause()
        {
            canvasGroup.blocksRaycasts = false;
        }
        public override void OnResume()
        {
            canvasGroup.blocksRaycasts = true;
        }
        public void buttenClick(string name)
        {
            UIManager.PushPanel(GetPanelType(name));
        }
        public void onCloseButten()
        {
            UIManager.PopPanel();
        }

    }
}
